package com.blog4j.user.api;

import com.blog4j.common.model.Result;
import com.blog4j.user.service.UserService;
import com.blog4j.user.vo.req.RegisterReqVo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author 98k灬
 * @version v1.0.0
 * @Description : 功能描述
 * @Create on : 2024/7/29 22:07
 **/
@RestController
@RequestMapping("/api")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class ApiUserController {
    private final UserService userService;

    /**
     * 用户注册
     *
     * @param reqVo 注册信息
     * @return 注册成功
     */
    @PostMapping("/register")
    public Result register(@RequestBody @Valid RegisterReqVo reqVo) {
        userService.register(reqVo);
        return Result.ok();
    }
}
